package com.ruoyi.project.jxc.controller;

import com.ruoyi.common.core.lang.UUID;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.jxc.domain.JxcMf;
import com.ruoyi.project.jxc.domain.JxcPurchase;
import com.ruoyi.project.jxc.service.IJxcPurService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/jxc/pur")
public class JxcPurController extends BaseController {
    @Autowired
    private IJxcPurService purService;
    @PreAuthorize("@ss.hasPermi('jxc:pur:list')")
    @GetMapping("/list")
    public TableDataInfo list(JxcPurchase pur)
    {
        startPage();
        List<JxcPurchase> jxcPurchases = purService.selectPurList(pur);
        return getDataTable(jxcPurchases);
    }
    @PreAuthorize("@ss.hasPermi('jxc:pur:add')")
    @Log(title = "订单管理", businessType = BusinessType.INSERT)
    @GetMapping("/ss")
    public String geneatorPurId()
    {
        String s = UUID.randomUUID().toString();
        int i = purService.insertPur(s);
        System.out.println(s);
        return toPurId(s);
    }
}
